﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;

public partial class Bidder_DrugsviewsAdd : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string strName, strContent;


        System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> _AccountType = new System.Collections.Generic.List<HZ.MBSM.DAL.AccountType>();
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumCompany);
        if (HZ.MBSM.BLL.Login.CheckAssert(_AccountType))
        {

            if (Request.Form["btnSubmit"] == "保  存")
            {
                HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];
                strName = Request.Form["txtName"];
                strContent = Request.Form["txtContentHtml"];
                if (strName.Trim().Length == 0)
                {
                    Response.Write("<script>alert('标题不能为空！！！');</script>");
                    return;
                }
                if (strContent.Trim().Length == 0)
                {
                    Response.Write("<script>alert('内容不能为空！！！');</script>");
                    return;
                }

                       
                HZ.MBSM.Model.Drugsviews Drugsviews = new HZ.MBSM.Model.Drugsviews();
                Drugsviews.Title = strName;
                Drugsviews.Content = strContent.Replace("\r\n", "");
                Drugsviews.AccountId = _Account.AccountId;
                Drugsviews.CreateDate = System.DateTime.Now;
                HZ.MBSM.BLL.Drugsviews DrugsviewsOperator = new HZ.MBSM.BLL.Drugsviews();
                if (DrugsviewsOperator.Add(Drugsviews))
                {
                    HZ.MBSM.BLL.LogManage.RecordLoginDetail(_Account.AccountName, Request.UserHostAddress, "插入", "Drugsviews", Drugsviews.AccountId + "|" + Drugsviews.Content + "|" + Drugsviews.CreateDate, "../Bidder/DrugsviewsAdd.aspx");
                    Response.Write("<script>alert('保存成功！！！');window.opener.location.reload();window.close();</script>");
                }
                else
                {
                    Response.Write("<script>alert('保存失败！！！');</script>");
                } 

            }
        }
    }
}
